package WaiBao;

import java.util.Arrays;

public class DuZhiXia {
    public static void main(String[] args) {
        String[] name = {"张晓伟(班长)", "李大红(副班长)", "小李(学习委员)", "李宁(纪律委员)", "马忠正(体育委员)", "李相赫", "张天罡", "李星云", "齐王", "李茂贞", "魏王", "韩束",
                "李德宝", "张村发", "李志生", "李翔宇", "长相", "李晨", "张晓晓", "任飞翔", "赵翔宇", "王星月", "王悦", "王型", "吕昆阳", "吕坤鹏", "吕思捷", "杨悦",
                "杨浩楠", "杜志霞(学生)"};//最后一位考生本人: 杜志霞(学生)
        int[] Age = {20, 22,21,22, 22, 19, 18, 18, 20, 19, 18, 21, 18,21, 20, 19, 18, 18, 18, 18,20, 19, 20, 19, 20, 20, 19, 18, 20, 20};//考生年龄：20岁

        double[]  maotao1 = {93, 84, 93, 80, 71, 87, 73, 49, 82, 90, 91, 87, 85, 79, 65, 68, 64, 79, 96, 88, 92, 91, 95, 88, 65, 74, 67, 84, 94, 96};
        double[]  maotao2 = {74, 84, 72, 70, 80, 71, 71, 74, 91, 75, 90, 70, 86, 76, 65, 68, 86, 79, 66, 68, 92, 78, 94, 85, 88, 85, 74, 66, 94, 95};
        double[]  maotao3 = {76, 98, 90, 81, 71, 64, 76, 79, 85, 60, 94, 87, 85, 75, 85, 68, 69, 69, 96, 93, 92, 81, 95, 90, 79, 84, 72, 71, 85, 96};

        double shixing1;//代表每个学生的总分
        double shixing2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            shixing1 = (maotao1)[i] + maotao2[i] +maotao3[i];
//            shixing2 = (shixing1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + shixing1);
//            System.out.println(name[i] + "的平均分为:" + shixing2);
//        }


        double kouzhao1 = 0, kouzhao2 = 0;
        double[] mianju = new double[30];
//        for (int i = 0; i < 30; i++) {
//            kouzhao1  =maotao1[i] + maotao2[i] + maotao3[i];
//            kouzhao2 = (kouzhao1 * 1.0) / 3;
//            mianju[i] =kouzhao2;
//        }
//
//        for (int i = 0; i < mianju.length - 1; i++) {
//            for (int j = 0; j <mianju.length - i - 1; j++) {
//                if (mianju[j] < mianju[j + 1]) {
//                    double tep = mianju[j];
//                    mianju[j] =mianju[j + 1];
//                    mianju[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(mianju[i]);
//        }


        double wangcai1 = 0,wangcai2 = 0,wangcai3 = 0;//计算每门课的平均分
        double xiaohei1 = 0,xiaohei2 = 0,xiaohei3 = 0;//计算每门课标准差
        double dabai1 = 0,dabai2 = 0, dabai3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < maotao1.length; i++) {
            sum2+=maotao1[i];
        }
        wangcai1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ wangcai1);
        double Sum = 0;
        for (int i = 0; i < maotao2.length; i++) {
            Sum+=maotao2[i];
        }
        wangcai2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+wangcai2);
        double sum = 0;
        for (int i = 0; i <maotao3.length; i++) {
            sum+=maotao3[i];
        }
        wangcai3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ wangcai3);
//
//
//////
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <maotao1.length; i++) {
            c1+= (maotao1[i] -wangcai1)*(maotao1[i] - wangcai1);
        }
        xiaohei1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+xiaohei1);

        for (int i = 0; i < maotao2.length; i++) {
            c2+= (maotao2[i] - wangcai2)*(maotao2[i] -wangcai2);
        }
        xiaohei2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+xiaohei2);

        for (int i = 0; i <maotao3.length; i++) {
            c3+= (maotao3[i] -wangcai3)*(maotao3[i] - wangcai3);
        }
        xiaohei3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+xiaohei3);
//////////////
////////////////
//        Arrays.sort(maotao1);
//        Arrays.sort(maotao2);
//        Arrays.sort(maotao3);
//        dabai1 =(maotao1[14]+maotao1[15])*1.0/2;
//        dabai2 =(maotao2[14]+maotao2[15])*1.0/2;
//        dabai3 =( maotao3[14]+maotao3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+dabai1);
//        System.out.println("微生物学的中位数为:"+dabai2);
//        System.out.println("人体组织解剖学的中位数为:"+dabai3);



    }
}
